package com.yunkazaixian.syntelecom.rabbitmq.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;

/**
 * Author:      gfl
 * Mail:        fuleiit@163.com
 * Date:        2023/10/15 17:29
 * Version:     1.0
 * Description:
 */
@Slf4j
// @Configuration
public class RabbitMQProducerConfig {
    /**
     * 配置生产者rabbitTemplate
     * 生产者只需要配置exchange和routingKey
     */
    @Bean(name = "pointRabbitTemplate")
    public RabbitTemplate pointRabbitTemplate(ConnectionFactory connectionFactory) {
        RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
//        rabbitTemplate.setExchange("EXCHANGE_NAME");
//        rabbitTemplate.setRoutingKey("ROUTING_KEY");
//        rabbitTemplate.setMandatory(true);
        return rabbitTemplate;
    }
}
